import requests 
import base64

# # client_id 为官网获取的AK， client_secret 为官网获取的SK
# host = 'https://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials&client_id=5fARq9QHrAxFlCE3qE6j08Co&client_secret=avFK9a4plvxUw3lTrg6F5AqN3sEz2ouF'
# response = requests.get(host)
# if response:
#     print(response)


request_url = "https://aip.baidubce.com/rest/2.0/ocr/v1/seal"
# 二进制方式打开图片文件
f = open('/Users/jaesun/Documents/WebProjects/web_learn/py/gz01.jpeg', 'rb')
img = base64.b64encode(f.read())

params = {"image":img}
print(params)



# access_token = "24.c55b85433843025eeee9c769141b83bf.2592000.1629811120.282335-24545600"
# request_url = request_url + "?access_token=" + access_token
# headers = {'content-type': 'application/x-www-form-urlencoded'}
# response = requests.post(request_url, data=params, headers=headers)
# if response:
#     print (response.json())